﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.CodeDom;
using System.Xml.Linq;

namespace CodeDomHelper.CodeDom
{

    [Serializable()]
    public class Cpermission : CDocRoot
    {

        public Cpermission()
            : base("permission")
        {

        }

        /// <summary>
        /// Initializes a new instance of the <see cref="Cpermission"/> class.
        /// </summary>
        /// <permission cref=""></permission>
        /// <param name="comment">The comment.</param>
        public Cpermission(CDocRoot comment)
            : base("permission", comment)
        {
            Cref = Cref;
        }


        public string Cref { get; protected set; }
        

        internal override bool Unique { get { return false; } }

        internal override string Serialize
        {
            get
            {

                string p = string.Format(ParamConst, "cref", Cref);

                StringBuilder s = new StringBuilder();
                s.AppendLine(string.Format(BaliseStartWith1ParamConst, Balise, p));

                s.AppendLine(Value);

                foreach (CDoc a in Nodes)
                    s.AppendLine(a.Serialize);

                s.AppendLine(BaliseEnd);

                return s.ToString();
            }
        }
    }


}
